package nowcoder;

import java.util.Scanner;

/**
 * n*m的，n代表列数，m代表行数，从左上角到右下角的路径数量，不能回头
 * 其实就是杨辉三角的模型
 */
public class 棋盘路径数量 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextLine()) {
            String line = scan.nextLine();
            String[] items = line.split(" ");
            int n = Integer.parseInt(items[0]);
            int m = Integer.parseInt(items[1]);
            System.out.println(pathCount(n, m));
        }
    }

    public static int pathCount(int n, int m) {
        int[][] array = new int[m][n];

        //斜着一排排的下去
        int max = (n - 1) + (m - 1);
        for (int index = 0; index <= max; index++) {
            for (int col = 0; col <= index && col < n; col++) {
                int row = index - col;
                if (row >= m) { //越界跳过
                    continue;
                }
                if (col == 0 || row == 0) { //边上走法只有一种，所以置位1
                    array[row][col] = 1;
                } else { //内部的走法=左边+上边
                    array[row][col] = array[row][col - 1] + array[row - 1][col];
                }
            }
        }
        return array[m - 1][n - 1];
    }
}
